package net.Stratus.ImageDumper;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public abstract class Site {
	protected IOHelper ioh;
		
	/**
	 * Starts the dump process.
	 */
	public abstract void dump();

	
	/**
	 * Starts the dump process.
	 */
	protected void initDump(Job job) {
		ioh = new IOHelper(job.getDirectory());
	}

	/**
	 * Uses validation RegEx to check if url is valid
	 * 
	 * @return url validity
	 */
	public static boolean isValidURL() {return false;}
	
	/**
	 * Checks if there are any matches in the url. If there are, the regex is valid
	 * 
	 * @param regEx regex to use
	 * @param url url to check
	 * @return if the url is valid
	 */
	protected static boolean validateURL(String regEx, String url) {
		Pattern p = Pattern.compile(regEx);
		Matcher m = p.matcher(url);
		int count = 0;
		return (m.find());	
	}
}
